﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DB_NH.DB_Map.ywxt.ProjectBZJ
{
    using NHibernate;
    using NHibernate.Mapping.ByCode;
    using NHibernate.Mapping.ByCode.Conformist;

    using DB_NH.DB_Model.ywxt.ProjectBZJ;

    public class ProjectFwfSQ_Map : ClassMapping<ProjectFwfSQ>
    {
        public ProjectFwfSQ_Map()
        {
            //映射ID
            Id(x => x.sqId, map => {
                map.Length(40);
                map.Column("sq_id");
            });

            Property(x => x.IsValid, map => { 
                map.Column("is_valid"); 
            });
            Property(x => x.CreateDate, map =>
            {
                map.Column("create_date");
            });

            Property(x => x.ProcessDescribe, map =>
            {
                map.Column("process_describe");
                map.Length(100000);
            });

            Property(x => x.sqDate, map =>
            {
                map.Column("sq_date");
            });

            Property(x => x.sqDescribe, map =>
            {
                map.Column("sq_describe");
                map.Length(100000);
            });

            Property(x => x.sqEndFlag, map =>
            {
                map.Column("is_end");
            });

            Property(x => x.sqEndDate, map =>
            {
                map.Column("end_date");
            });

            Property(x => x.sqTuiFlag, map =>
            {
                map.Column("sq_flag");
            });

            //关联
            Bag(x => x.sqDetails, map =>
            {
                map.Key(keyMapper => keyMapper.Column("sq_id"));
                map.Cascade(Cascade.None);
            }, rel => rel.OneToMany());

            //关联操作员
            ManyToOne(x => x.opUser, map =>
            {
                map.Column("op_user_id");
            });

            Table("t_fwf_sq");

            //不进行创建
            //SchemaAction(NHibernate.Mapping.ByCode.SchemaAction.None);
        }
    }
}
